<template>
  <div class="home">
    <div class="hero-section">
      <div class="hero-content">
        <h1>PowerBI Web 版</h1>
        <p>基于 Vue3 + JavaScript 的数据可视化平台</p>
        <div class="hero-actions">
          <el-button type="primary" size="large" @click="goToDesigner">
            开始设计
          </el-button>
          <el-button size="large" @click="goToDataCleaning">
            数据清洗
          </el-button>
          <el-button size="large" @click="goToDataModel">
            数据模型
          </el-button>
          <el-button size="large" @click="viewDemo">
            查看演示
          </el-button>
        </div>
      </div>
      <div class="hero-image">
        <div class="demo-chart">
          <div class="chart-placeholder">
            <el-icon size="80" color="#409EFF"><TrendCharts /></el-icon>
            <p>数据可视化</p>
          </div>
        </div>
      </div>
    </div>
    
    <div class="features-section">
      <div class="container">
        <h2>核心功能</h2>
        <div class="features-grid">
          <div class="feature-card">
            <el-icon size="48" color="#409EFF"><Grid /></el-icon>
            <h3>拖拽设计</h3>
            <p>直观的拖拽界面，轻松创建数据可视化</p>
          </div>
          <div class="feature-card">
            <el-icon size="48" color="#67C23A"><Histogram /></el-icon>
            <h3>多种图表</h3>
            <p>支持柱状图、折线图、饼图等多种图表类型</p>
          </div>
          <div class="feature-card">
            <el-icon size="48" color="#E6A23C"><Operation /></el-icon>
            <h3>数据清洗</h3>
            <p>智能数据清洗功能，自动处理空值、重复和异常数据</p>
          </div>
          <div class="feature-card">
            <el-icon size="48" color="#F56C6C"><Connection /></el-icon>
            <h3>数据模型</h3>
            <p>强大的数据建模功能，支持多表关系和计算字段</p>
          </div>
        </div>
      </div>
    </div>
    
    <div class="workflow-section">
      <div class="container">
        <h2>数据处理工作流</h2>
        <DataFlowManager />
      </div>
    </div>
    
    <div class="stats-section">
      <div class="container">
        <div class="stats-grid">
          <div class="stat-item">
            <h3>1000+</h3>
            <p>活跃用户</p>
          </div>
          <div class="stat-item">
            <h3>50+</h3>
            <p>图表模板</p>
          </div>
          <div class="stat-item">
            <h3>99.9%</h3>
            <p>系统稳定性</p>
          </div>
          <div class="stat-item">
            <h3>24/7</h3>
            <p>技术支持</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import DataFlowManager from '../components/DataFlowManager.vue'
import { 
  TrendCharts, 
  Grid, 
  Histogram, 
  Operation, 
  Connection 
} from '@element-plus/icons-vue'

const router = useRouter()

const goToDesigner = () => {
  router.push('/designer')
}

const goToDataCleaning = () => {
  router.push('/data-cleaning')
}

const goToDataModel = () => {
  router.push('/data-model')
}

const viewDemo = () => {
  // 可以跳转到演示页面或者直接跳转到设计器
  router.push('/designer')
}
</script>

<style scoped>
.home {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hero-section {
  display: flex;
  align-items: center;
  min-height: 80vh;
  padding: 0 5%;
  color: white;
}

.hero-content {
  flex: 1;
  max-width: 600px;
}

.hero-content h1 {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #fff, #e3f2fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

.hero-image {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.demo-chart {
  width: 300px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: white;
}

.chart-placeholder p {
  margin-top: 1rem;
  font-size: 1.1rem;
}

.features-section {
  background: white;
  padding: 5rem 0;
}

.workflow-section {
  padding: 5rem 0;
  background: #f8f9fa;
}

.workflow-section h2 {
  text-align: center;
  margin-bottom: 3rem;
  color: #303133;
  font-size: 2rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.features-section h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: #303133;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature-card {
  text-align: center;
  padding: 2rem;
  border-radius: 12px;
  background: #f8f9fa;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.feature-card h3 {
  margin: 1rem 0;
  color: #303133;
  font-size: 1.25rem;
}

.feature-card p {
  color: #606266;
  line-height: 1.6;
}

.stats-section {
  background: #f5f7fa;
  padding: 3rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.stat-item {
  text-align: center;
  padding: 1.5rem;
}

.stat-item h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #409EFF;
  margin-bottom: 0.5rem;
}

.stat-item p {
  color: #606266;
  font-size: 1.1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero-section {
    flex-direction: column;
    text-align: center;
    padding: 2rem 5%;
  }
  
  .hero-content h1 {
    font-size: 2.5rem;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
</style>
